package com.qmo.edu.moudle.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;

import com.qmo.edu.R;
import com.qmo.edu.base.BaseActivity;
import com.qmo.edu.moudle.activity.LoginActivity;

public class SplashActivity extends BaseActivity {


    private Handler mHandler = new Handler();


    @Override
    public int setLayoutId() {
        return R.layout.activity_splash;
    }


    protected void initData() {

        mHandler.postDelayed(() -> {
            Intent intent = new Intent();
            intent.setClass(SplashActivity.this, LoginActivity.class);
            startActivity(intent);
            finish();
        }, 1000 * 3);

    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        initData();
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mHandler != null) {
            mHandler.removeCallbacksAndMessages(null);
            mHandler = null;
        }
    }
}
